Today we’re going to make a reproducible report about volatile oils in dead juniper trees. This is a collaboration with YoungLiving Essential Oil, Inc.
First off, we have to load the data set:
df <- read.csv("./Data/Juniper_Oils.csv")
BUT… this data needs some cleaning before we can make it useful. It is currently in a wide format, where each compound is in it’s own column.
names(df) <- names(df) %>% make_clean_names()
compounds <- names(df)[11:33]
long <- df %>%
filter(amplicon == "16S") %>%
pivot_longer(compounds, names_to = "compound", values_to= "yield")
Now that it’s cleaned up a bit, we can plot the compound yields over time since burn…
p1 <- ggplot(long, aes(x=years_since_burn, y=yield)) +
geom_smooth() +
geom_point() +
facet_wrap(~compound, scales = "free")
Here’s some summary info about the compounds that were observed:
summarized_compound <- long %>%
group_by(compound) %>%
summarize(MeanConcentration = mean(yield))
knitr :: kable(summarized_compound,row.names = FALSE, digits = 4,caption = "Mean concentration values across entire study")
| compound | MeanConcentration |
|---|---|
| alpha_acorenol | 0.2765 |
| alpha_cedrene | 10.9000 |
| alpha_chamigrene | 0.6353 |
| alpha_eudesmol | 0.8706 |
| alpha_himachalene | 0.3471 |
| alpha_pinene | 0.3000 |
| alpha_terpineol | 1.2294 |
| beta_acorenol | 0.5824 |
| beta_cedrene | 3.0529 |
| beta_chamigrene | 0.9824 |
| beta_eudesmol | 2.0647 |
| cedr_8_en_13_ol | 5.8294 |
| cedr_8_en_15_ol | 1.7294 |
| cedr_9_ene | 0.7176 |
| cedrol | 20.1000 |
| cis_thujopsene | 21.5753 |
| compound_1 | 2.0941 |
| compound_2 | 1.0941 |
| cuparene | 2.2000 |
| gamma_eudesmol | 1.5412 |
| para_cymene | 0.6294 |
| thujopsenal | 2.0647 |
| widdrol | 6.4118 |
We can also do something to make this plot interactive!
This uses the “plotly” package
ggplotly(p1)